from django.db import models


class Album(models.Model):
    title = models.CharField(verbose_name="相册名", max_length=20)
    desc = models.TextField()
    is_del = models.BooleanField(default=False)
    pub_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'photo_album'
        verbose_name = "相册表"
        verbose_name_plural = verbose_name


class Photo(models.Model):
    thumbnail = models.URLField()
    album = models.ForeignKey(Album, on_delete=models.CASCADE)
    is_del = models.BooleanField(default=False)
    pub_time = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = 'photo'
        verbose_name = "相片表"
        verbose_name_plural = verbose_name
